export function getValueName(valueSetList, code, setCode = '') {
  return listDestValue(
    setCode ? valueSetList.filter((item) => item.setCode === setCode) : valueSetList,
    code,
    'code',
    'name',
    false,
  )
}
export const listDestValue = function (list, value, key = 'id', destKey = 'name', showValue = false) {
  if (value === null || value === undefined) {
    return ''
  }
  if (typeof list === 'object' && Object.prototype.toString.call(list).toLowerCase().includes('array')) {
    const destValue = list.find((item) => item[key] + '' === value + '')
    if (destValue) {
      return destValue[destKey]
    }
  }
  return showValue ? value : ''
}
